<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('账户别名')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            关键字：<input type="text" placeholder="关键字" name="keyWords"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:accountAlias:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:accountAlias:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:accountAlias:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" @click="synchronizedAccountAlias()" shiro:hasPermission="system:accountAlias:sync">
                <i class="fa fa-download"></i> 同步EBS账户别名
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:accountAlias:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:accountAlias:remove')}]];
    var prefix = ctx + "accountAlias";

    $(function () {
        var options = {
            url: prefix + "/findList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "账户别名",
            uniqueId: 'aliasId',
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'aliasId',
                    title: '账号别名ID',
                    align: 'center',
                    visible: false
                },
                {
                    field: 'accountAlias',
                    title: '账号别名',
                    align: 'center',
                    visible: true
                },
                {
                    field: 'description',
                    title: '描述',
                    align: 'center'
                },
                {
                    field: 'type',
                    title: '类型',
                    align: 'center'
                },
                {
                    field: 'effectiveDate',
                    title: '有效时间',
                    align: 'center'
                },
                {
                    field: 'disableDate',
                    title: '失效时间',
                    align: 'center'
                },
                {
                    field: 'enabledFlag',
                    title: '生效标识',
                    align: 'center'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index){
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.aliasId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.aliasId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });
    var app = new Vue({
        el: '.container-div',
        methods: {
            synchronizedAccountAlias: function(){
                $.modal.confirm("是否确定同步?", function(){
                    $.operate.get("/accountAlias/synchronizedAccountAlias");
                });
            }
        }
    })
</script>
</body>
</html>